//
//  PhotoModel.swift
//  Created by wang tiao on 2025/4/19.
//

import Foundation
import Photos

public extension PhotoModel {
    enum MediaType: Int {
        case unknown = 0
        case image
        case gif
        case livePhoto
        case video
    }
}

public class PhotoModel: NSObject {
    
    var thumbnailImage: UIImage?
    var originalImage: UIImage?
    var thumbnailPath: String?
    var filePath: String?
    var anyObject: AnyObject?
    
    var url: String?
    public var type: PhotoModel.MediaType = .unknown
    public var whRatio: CGFloat {
        return 1
    }
    
    public var previewSize: CGSize {
        let scale: CGFloat = UIScreen.main.scale
        if whRatio > 1 {
            let h = min(UIScreen.main.bounds.height, PhotoMaxImageWidth) * scale
            let w = h * whRatio
            return CGSize(width: w, height: h)
        } else {
            let w = min(UIScreen.main.bounds.width, PhotoMaxImageWidth) * scale
            let h = w / whRatio
            return CGSize(width: w, height: h)
        }
    }

}
